package com.xiu.jvm.gc;

import java.util.ArrayList;
import java.util.List;
/**
 * VM args: -Xms100M -Xmx100M -XX:+UseSerialGC
 * 
 * @author wangxinxin
 *
 */
public class JConsole {
	static class OOMObject {
		public byte[] placeholder = new byte[64 * 1024];
	}

	public static void fillHeap(int num) throws InterruptedException {
		List<OOMObject> list = new ArrayList<OOMObject>();
		for (int i = 0; i < num; i++) {
			Thread.sleep(500);
			list.add(new OOMObject());
		}
	}

	public static void main(String[] args) throws Exception {
		fillHeap(100);
	}

}
